package com.itqf.Controller;

import com.github.pagehelper.PageInfo;
import com.itqf.Service.Topic.TopicService;
import com.itqf.Util.myPageInfo;
import com.itqf.entity.Topic;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class JingPinTopController {
    @Resource
    private TopicService topicService;

    //精品资料，今日推荐接口
    @RequestMapping(value = "/jingpintop",method = RequestMethod.GET)
    @ResponseBody
    public List<Topic> getJingpinTopJson()
    {
      List<Topic> list=topicService.findtopics();
      return list;
    }
    //精品资料，初中真题接口
    @RequestMapping(value = "/chuzhongzhenti",method = RequestMethod.GET)
    @ResponseBody
    public PageInfo getchuzhongzhenti(@RequestParam(defaultValue = "1") int pageindex)
    {
       PageInfo<Topic> pageInfo=topicService.findchuzhongtops(pageindex, myPageInfo.PAGESIZE);
       return pageInfo;
    }

}
